﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Diagnostics.Stopwatch a = new System.Diagnostics.Stopwatch();
            a.Start();

            //并行循环
            System.Threading.Tasks.Parallel.For(0, 100000, (i) => { Console.WriteLine(i.ToString()); });
            a.Stop();
            Console.WriteLine(a.ElapsedMilliseconds.ToString());
            Console.ReadKey();

            a.Restart();
            a.Start();
            for (int n = 0; n < 100000; n++)
            {
                //串行循环
                Console.WriteLine(n.ToString()); 
            }
            a.Stop();
            Console.WriteLine(a.ElapsedMilliseconds.ToString());
            Console.ReadKey();

        }
    }
}
